import axios from "../../axios"

// 用户登录
export function userLogin(userId, userPassword) {
    return axios.post('/userLogin?loginUserId=' + userId + '&loginUserPassword=' + userPassword)
}

//新增用户
export function addUser(data) {
    return axios({
        method: 'POST',
        url: '/addUser',
        params: data,
    })
}

//获取用户个人信息
export function getUserInfoById(userId) {
    return axios.get('/getUserInfoById?userId=' + userId)
}


//获取用户角色
export function getUserRole(userId) {
    return axios.get('/getUserRole?getUserRoleUserId=' + userId)
}

//用户修改个人信息
export function userUpdateInformation(data) {
    return axios({
        method: 'PUT',
        url: '/userUpdateInformation',
        params: data,
    })
}

//用户修改密码
export function userUpdatePassword(userId, oldPassword, newPassword) {
    return axios.put('/userUpdatePassword?userId=' + userId + '&oldPassword=' + oldPassword + '&newPassword=' + newPassword)
}

//综合办修改用户信息
export function adminUpdateUser(data) {
    return axios({
        method: 'PUT',
        url: '/adminUpdateUser',
        params: data,
    })
}

//删除用户角色
export function deleteUserRole(userId) {
    return axios.delete('/deleteUserRole?userId=' + userId)
}

//为用户新增角色
export function addUserRole(data) {
    return axios.post('/addUserRole', data)
}

//删除用户
export function deleteUser(userId) {
    return axios.delete('/deleteUser?userIdDelete=' + userId)
}

//获取角色菜单
export function getRoleBusiness(userRole) {
    return axios.get('/getRoleBusiness?BusinessUserRole=' + userRole)
}

//获取全部角色
export function getAllRoles() {
    return axios.get('/getAllRoles')
}

//获取可以添加的菜单（不在该角色菜单中的菜单）
export function getOtherMenus(userRole) {
    return axios.get('/getOtherMenus?userRoleGetOthers=' + userRole)
}

//为角色添加可以访问的菜单
export function addRoleMenu(data) {
    return axios.post('/addRoleMenu', data)
}

//新增角色
export function addRole(roleName) {
    return axios.post('/addRole?roleAdd=' + roleName)
}

//删除角色
export function deleteRole(roleName) {
    return axios.delete('/deleteRole?roleDelete=' + roleName)
}

//删除角色对应菜单
export function deleteRoleMenu(userRole, businessId) {
    return axios.delete('/deleteRoleMenu?userRoleDelete=' + userRole + '&businessIdDelete=' + businessId)
}

export function getAllUser() {
    return axios.get('/getAllUser')
}

export function getAllDepartment() {
    return axios.get('/getAllDepartment')
}

export function getAllPosition() {
    return axios.get('/getAllPosition')
}
